<!--
/* Powered by JYWAP & jy.qhxin.com */
var faceInited = false;
//显示表情
function showFace(ev) {
	if(!faceInited) {
		initFace();
	}
	var facePanel= $("facePanel");
	facePanel.style.display = "block";
	addEvent(document.body, 'click', hideFace);
	addEvent(facePanel, 'click', cancelEventBubble);
	cancelEventBubble(ev);
}
//隐藏表情
function hideFace() {
	$("facePanel").style.display = "none";
	removeEvent(document.body, 'click', hideFace);
	removeEvent($("facePanel"), 'click', cancelEventBubble);
}

//插入表情
function insertFace(elem) {
	var txtElem = $("txtDemo");
	txtElem.value += elem.getAttribute("value");
	txtElem.focus();
	hideFace();
}

//取消事件冒泡
function cancelEventBubble(ev) {
	ev = ev || window.event;
	if(ev.stopPropagation) {
		ev.stopPropagation();
	} else if(!ev.cancelBubble) {
		ev.cancelBubble = true;
	}
}

//初始化表情
function initFace() {
var faces = [
	{"icon":"开心","value":"{JYFACE:1}","src":"1.png"},
	{"icon":"惊讶","value":"{JYFACE:2}","src":"2.png"},
	{"icon":"咬牙","value":"{JYFACE:3}","src":"3.png"},
	{"icon":"汗水","value":"{JYFACE:4}","src":"4.png"},
	{"icon":"大哭","value":"{JYFACE:5}","src":"5.png"},
	{"icon":"伤心","value":"{JYFACE:6}","src":"6.png"},
	{"icon":"卖萌","value":"{JYFACE:7}","src":"7.png"},
	{"icon":"懂了","value":"{JYFACE:8}","src":"8.png"},
	{"icon":"吓尿","value":"{JYFACE:9}","src":"9.png"},
	{"icon":"赞","value":"{JYFACE:10}","src":"10.png"}];
	var imgURI = "jy_src/face/";
	var tempArr = [];
	tempArr.push('<ul>');
	for(var i=0, len = faces.length; i<len; i++) {
		tempArr.push([
			'<li><a href="javascript:;" hideFocus="true" onclick="insertFace(this);return false;" value="' + faces[i].value + '" title="' + faces[i].icon + '"><img src="' + imgURI + faces[i].src + '" alt="' + faces[i].icon + '" /><span>&nbsp;</span></a></li>',
			].join(""));
	}
	tempArr.push('</ul>');
	$("facePanel").innerHTML = tempArr.join("");
}
-->